package com.abluedog.c1;

import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;

import static com.abluedog.util.ByteBufferUtil.debugAll;

public class ScatteringReadsTest {

    public static void main(String[] args) {
        ByteBuffer buffer1 = ByteBuffer.allocate(3);
        ByteBuffer buffer2 = ByteBuffer.allocate(3);
        ByteBuffer buffer3 = ByteBuffer.allocate(5);

        ByteBuffer[] buffers = {buffer1, buffer2, buffer3};

        try (RandomAccessFile r = new RandomAccessFile("words.txt", "r")) {
            r.getChannel().read(buffers);
            for (ByteBuffer buffer : buffers) {
                buffer.flip();
                debugAll(buffer);
            }
        } catch (IOException e) {
        }
    }
}
